package Reflection;

public class demo1 {
    public static void main(String[] args) throws ClassNotFoundException {

        //通过类名来获取Class对象
        Class c1 = Cat.class;
        System.out.println(c1.getName());

        //通过全类名获取Class对象
        Class c2 = Class.forName("Reflection.Cat");
        System.out.println(c2.getName());
        //通过对象名来获取
        Cat cat = new Cat();
        Class c3 = cat.getClass();
        System.out.println(c3.getName());

        System.out.println(c1 == c2);
        System.out.println(c3 == c2);
        System.out.println(c1 == c3);
    }
}
